//
//  BaseTableListController.m
//  BaseProject
//
//  Created by 陈家将 on 16/9/24.
//  Copyright © 2016年 szteyou. All rights reserved.
//

#import "KMBaseTableListController.h"

@interface KMBaseTableListController ()

@property (assign, nonatomic, getter=isFirstRequest) BOOL firstRequest;

@end

@implementation KMBaseTableListController

- (void)viewDidLoad {
    [super viewDidLoad];
    [self baseTableListInit];
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    
}

- (void)baseTableListInit {
    self.firstRequest = YES;
    self.view.frame = SCREEN_BOUNDS_WITHOUT_NAV_AND_TABBAR_TOP_MARGIN(KMListHeaderHeight);
}

- (void)requestData {
    DBLog(@"请在当前控制器重写requestData方法");
}

- (void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(NSDictionary<NSString *,id> *)change context:(void *)context {
    if ([keyPath isEqual:@"requestVc"]) {
        if ([self isEqual:change[@"new"]] && self.isFirstRequest) {
            self.firstRequest = NO;
            [self requestData];
        }
    }
}

@end
